package com.hunan.api.catv.action.jiapiao;

import com.hunan.api.catv.action.BaseAction;
import com.hunan.api.catv.annotation.MemberAuth;
import com.hunan.api.catv.common.Api;
import com.hunan.api.catv.entity.Result;
import com.hunan.api.catv.service.biz.toupiao.TouPiaoBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(Api.ticket)
@Validated
public class AddTicketToUserAction extends BaseAction {

    @Autowired
    TouPiaoBiz touPiaoBiz;

    @MemberAuth
    @PostMapping("/add")
    public Result addTicket(HttpServletRequest request, Integer type) {
        return buildResult(touPiaoBiz.addTicketToUser(getMemberId(request), type));
    }
}
